package com.dingli.shop.controller;

import com.dingli.shop.biz.OrderBiz;
import com.dingli.shop.vo.JsonVo;
import com.dingli.shop.vo.Meta;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@CrossOrigin
@Controller
public class UpdateAddress {
    @Autowired
    private OrderBiz orderBiz;
    @PutMapping("/ordersUp")
    public @ResponseBody
    JsonVo orders(@RequestBody HashMap<String, Object> map) {
        Map<String,Object> map1=new HashMap<>();
        map1.put("id",map.get("id"));
        map1.put("address",map.get("address"));
        System.out.println("++++++++++++++++++++++++++++++++++++++++++++++");
        System.out.println(map);
        System.out.println(map1);
        System.out.println("++++++++++++++++++++++++++++++++++++++++++++++");
        orderBiz.updateAddress(map1);
        Meta meta = new Meta();
        meta.setMsg("修改订单地址成功");
        meta.setStatus(200);
        JsonVo jsonVo = new JsonVo();
        jsonVo.setMeta(meta);
        return jsonVo;
    }
}
